<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<div class="modal-dialog demo2do-modal-dialog" style="width: 950px;">

  <div class="modal-content">

    <div class="modal-header seededu-breadcrumb no-bottom-border clearfix">
      <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>学生管理&nbsp;-&nbsp;学生查询</span></h2>
      <button type="button" class="close" data-dismiss="modal">&times;</button>
    </div>

    <form class="form-horizontal" method="get" action="">

      <div class="modal-body">

        <div class="form-group demo2do-form-group">
          <label class="col-xs-2 control-label">姓名</label>
          <div class="pull-left width-30-percent">
            <input type="text" name="name" class="form-control" >
          </div>
          
          <label class="col-xs-2 control-label">学校</label>
          <div class="pull-left width-30-percent">
            <input type="hidden" name="schoolId" class="form-control" >
          </div>
        </div>

        <div class="form-group demo2do-form-group">
          <label class="col-xs-2 control-label">年级</label>
          <div class="pull-left width-30-percent">
            <input type="text" name="grade" class="form-control" >
          </div>
          
          <label class="col-xs-2 control-label">手机号</label>
          <div class="pull-left width-30-percent">
            <input type="text" name="cellPhone" class="form-control">
          </div>
        </div>

        <div class="form-group demo2do-form-group">
          <label class="col-xs-2 control-label">项目</label>
          <div class="pull-left width-30-percent">
            <select name="fid" class="form-control">
              <option value="">请选择</option>
              <option value="1">丝绸之路</option>
              <option value="2">志愿海南</option>
              <option value="3">模拟商赛</option>
              <option value="4">商赛</option>
              <option value="5">AAPT(国内)</option>
              <option value="6">AAPT(国外)</option>
              <option value="7">WYEF</option>
              <option value="8">数学竞赛(国内)</option>
              <option value="9">数学竞赛(国外)</option>
              <option value="10">模联</option>
              <option value="11">Mini MBA</option>
            </select>
          </div>
            
          <label class="col-xs-2 control-label">子项目</label>
          <div class="pull-left width-30-percent">
            <input type="hidden" name="subProId" class="form-control" >
          </div>
        </div>

      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success demo2do-btn">搜索</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>

</div>

<script type="text/javascript">

  $(document).ready(function() {
	  
	  $('select[name="fid"]').select2({
		  minimumResultsForSearch : -1
	  })
	  
	  $('input[name="schoolId"]').select2({
		  placeholder: '搜索学校',
		  minimumInputLength: 1,
		  ajax: {
			  url: '${ctx}/schools/search-school-signature',
			  cache: true,
			  dataType: 'json',
			  data: function(term) { return { name: term }; },
			  results: function(data) { return { results: data }; }
			},
			formatResult: function(item) { return item.name; },
			formatSelection: function(item) { return item.name; }
	  })
	  
	  $('input[name="subProId"]').select2({
      placeholder: '搜索子项目',
      minimumInputLength: 1,
      id: function(object) { return object.spid },
      ajax: {
        url: '${ctx}/projects/search-project-signature',
        cache: true,
        dataType: json,
        data: function(term) { return { name: term } },
        results: function(data) { return { results: data } } 
      },
      formatResult: function(item) { return item.name },
      formatSelection: function(item) { return item.name }
    })

	  
  })

</script>
